import Request from '@/libs/request'

/** 查询字典类型 分页 */
export const selectSysDictTypeByPage = (
  data: {
    dictTypeCode: string
    dictTypeName: string
  } & Paging
) =>
  Request.get<PagingResponse<SysDict.Type>>(
    '/mg/mSelectSysDictTypeByPage',
    data
  )

/** 字典类型 增加 */
export const addSysDictType = (data: SysDict.AddTypeDataSource) =>
  Request.get<null>('/mg/mAddSysDictType', data)

/** 字典类型 增加 */
export const editSysDictType = (data: SysDict.EditTypeDataSource) =>
  Request.get<null>('/mg/mEditSysDictType', data)

/** 字典类型 所有类型查询 */
export const selectAllSysDictType = () =>
  Request.get<SysDict.Type[]>('/mg/mSelectAllSysDictType')

/** 字典数据 分页查询 */
export const selectDictItemByPage = (
  data: {
    dictTypeCode: string
    dictName: string
    dictCode: string
  } & Paging
) =>
  Request.get<PagingResponse<SysDict.Item>>('/mg/mSelectDictItemByPage', data)

/** 字典数据 增加 */
export const addSysDictItem = (data: SysDict.AddItemDataSource) =>
  Request.get<null>('/mg/mAddSysDictItem', data)

/** 字典数据 修改 */
export const editSysDictItem = (data: SysDict.EditItemDataSource) =>
  Request.get<null>('/mg/mEditSysDictItem', data)

/**通过字典数据代码查询该数据下的所有数据 */
export const selectItemByCode = (data: {code: string}) =>
  Request.get<SysDict.Item[]>('/mg/mSelectItemByCode', data)

/**查询字典类型下的参数 */
export const selectItemByTypeSign = (data: {dataType: string}) =>
  Request.get<SysDict.Item[]>('/selectItemByTypeSign', data)
